/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Checkbox buttons
.composer {
    .checkbox-label {
        display: block;
        position: relative;
        padding-left: $space-large;
        cursor: pointer;
        font-size: 0.95em;

        &::before {
            content: '';
            position: absolute;
            top: -1px;
            left: 0;
            height: $space-medium;
            width: $space-medium;
            background: #fff;
            border: 1px solid $first-highlight;
        }
    }

    input[type=checkbox] {
        position: absolute;
        z-index: -1;
        opacity: 0;
    }

    input[type=checkbox] + .checkbox-label {
        &::before {
            border: 1px solid $first-highlight;
        }
    }
    input[type=checkbox]:focus + .checkbox-label {
        &::before {
            border: 2px solid $first-highlight !important;
            left: -1px !important;
            top: -2px !important;
        }
    }

    input[type=checkbox]:checked + .checkbox-label {
        &::before {
            border: 1px solid $first-highlight;
        }
    }

    input[type=checkbox]:not([disabled]):checked + .checkbox-label,
    input[type=checkbox]:checked:focus + .checkbox-label {
        &:hover {
            &::before {
                background: #fff;
                border: 1px solid $first-highlight;
            }
        }
    }

    input[type=checkbox]:disabled + .checkbox-label {
        &::before {
            background: $third-highlight;
            opacity: 0.5;
            pointer-events: none;
        }
    }

    .checkbox-label::after {
        content: '';
        position: absolute;
        display: block;
        transform: scale(0.5);
        opacity: 0;
        transition: 0.3s;
    }

    input[type=checkbox]:checked + .checkbox-label {
        &::after {
            display: block;
            background-color: $first-highlight;
            transform: scale(1);
            opacity: 1;
        }
    }

    .checkbox-label::after {
        left: 5px;
        top: 4px;
        width: $space-smedium;
        height: $space-smedium;
    }

    input[type=checkbox]:disabled + .checkbox-label {
        &::after {
            border-color: $first-highlight;
        }
    }
}